//
//  XDAssetDetailView.m
//  xindailianmeng
//
//  Created by 张东 on 2017/3/14.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDAssetDetailView.h"
#import "XDAssetDetails.h"

@interface XDAssetDetailView ()

@property (weak, nonatomic) IBOutlet UILabel *totalMoneyLb;

@property (weak, nonatomic) IBOutlet UILabel *youXuanLb;
@property (weak, nonatomic) IBOutlet UILabel *sanBiaoLb;
@property (weak, nonatomic) IBOutlet UILabel *avaMoneyLb;

@end


@implementation XDAssetDetailView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        self = [[NSBundle mainBundle] loadNibNamed:@"XDAssetDetailView" owner:self options:nil].firstObject;
        
    }
    return self;
}

- (void)setAssetDic:(XDAssetDetails *)assetDic {
    
    _assetDic = assetDic;
//    totalMoney ：账户总资产 double 保留两位小数点
//    avaMoney：可用余额 double 保留两位小数点
//    youXuan：优选计划 double 保留两位小数点
//    sanBiao：散标 double 保留两位小数点
//    plus : 可用余额前的+ string
    NSString *totalMoney = [NSString stringWithFormat:@"%.2f元",assetDic.totalMoney];
    NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithString:totalMoney];
    [att addAttribute:NSFontAttributeName value:kBaseFont_(25) range:[totalMoney rangeOfString:@"元"]];
    self.totalMoneyLb.attributedText = att;
    
    self.youXuanLb.text = [NSString stringWithFormat:@"%.2f元",assetDic.youXuan];
    
    self.sanBiaoLb.text = [NSString stringWithFormat:@"%.2f元",assetDic.sanBiao];
    
    self.avaMoneyLb.text = [NSString stringWithFormat:@"%.2f元",assetDic.avaMoney];
}
@end
